package com.aaa.phone.service.storeservice.impl;

import com.aaa.entity.AppSecondStore;
import com.aaa.phone.dao.storedao.StoreDao;
import com.aaa.phone.service.storeservice.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @program: battery
 * @description: 商城及二手市场
 * @author: liangyongzhen
 * @create: 2018-12-19 20:50
 **/
@Service
public class StoreServieImpl implements StoreService {

    @Autowired
    private StoreDao storeDao;

    /**
     * @Description: 获取所有的电动车信息
     * @Param:
     * @return:
     * @Author: liangyongzhen
     * @Date: 2018/12/19
     */
    @Override
    public List<Map> getAllCarInfo() {

        List<Map> carList = storeDao.getAllCarInfo();
        return carList;
    }
    /**
     * @Description: 根据id获取电动车信息
     * @Param: [id]
     * @return: java.util.List<java.util.Map>
     * @Author: liangyongzhen
     * @Date: 2018/12/20
     */
    @Override
    public List<Map> getCarInfoById(Integer id) {
        List<Map> carList = storeDao.getCarInfoById(id);
        return carList;
    }

    /**
    * @Description: 获取一些信息用于预览
    * @Param: []
    * @return: java.util.List<java.util.Map>
    * @Author: liangyongzhen
    * @Date: 2018/12/25
    */ 
    @Override
    public List<Map> getSomeInfo() {
        List<Map> someInfo = storeDao.getSomeInfo();
        return someInfo;
    }


    /**
     * @Description: 获取所有的配件信息
     * @Param:
     * @return:
     * @Author: liangyongzhen
     * @Date: 2018/12/19
     */
    @Override
    public List<Map> getAllPartsInfo() {

        List<Map> carList = storeDao.getAllPartsInfo();
        return carList;
    }
    /**
     * @Description: 根据id获取配件信息
     * @Param: [id]
     * @return: java.util.List<java.util.Map>
     * @Author: liangyongzhen
     * @Date: 2018/12/20
     */
    @Override
    public List<Map> getPartInfoById(Integer id) {
        List<Map> carList = storeDao.getPartInfoById(id);
        return carList;
    }

    /**
     * @Description: 添加二手车信息
     * @Param: [secondHandCar]
     * @return: int
     * @Author: liangyongzhen
     * @Date: 2018/12/21
     */
    @Override
    public void addSecondCarInfo(AppSecondStore secondHandCar) {
        storeDao.addSecondCarInfo(secondHandCar);
    }


    /**
     * @Description: 查询二手车信息
     * @Param: []
     * @return: java.util.List<com.aaa.entity.AppSecondStore>
     * @Author: liangyongzhen
     * @Date: 2018/12/22
     */
    @Override
    public List<AppSecondStore> getAllSecondCarInfo() {
        List<AppSecondStore> secondCarInfoList = storeDao.getAllSecondCarInfo();
        return secondCarInfoList;
    }

    /**
     * @Description: 根据telephone查询二手车信息
     * @Param: [telephone]
     * @return: java.util.List<com.aaa.entity.AppSecondStore>
     * @Author: liangyongzhen
     * @Date: 2018/12/22
     */
    @Override
    public List<AppSecondStore> getSecondCarInfoByTel(String telephone) {
        List<AppSecondStore> secondCarInfoList = storeDao.getSecondCarInfoByTel(telephone);
        return secondCarInfoList;
    }

}
